#ifndef __PID_BASE_H_
#define __PID_BASE_H_

typedef struct
{
    float P;
    float I;
    float D;
    float Desired;
    float Error;
    float PreError;
    float PrePreError;
    float Increment;
    float Integ;
    float iLimit;
    float Deriv;
    float Output;    
}PID_Typedef;

#include "includefile.h"

#define PID_set_P_I_D(x,p,i,d) {x.P=p;x.I=i;x.D=d;}
#define PID_updataPID_by_flash(x,p) {x.P=p.P;x.I=p.I;x.D=p.D;}
#define PID_updatePID2_by_flash(a,b,c,d,e,f,g);         PID_updataPID_by_flash(b,a.pid_angle_roll);\
                                                        PID_updataPID_by_flash(c,a.pid_angle_pitch);\
                                                        PID_updataPID_by_flash(d,a.pid_angle_yaw);\
                                                        PID_updataPID_by_flash(e,a.pid_palstance_roll);\
                                                        PID_updataPID_by_flash(f,a.pid_palstance_pitch);\
                                                        PID_updataPID_by_flash(g,a.pid_palstance_yaw);
#define PID_updatePID3_by_flash();  PID_updatePID2_by_flash(argue_table,   \
                                                            pid_angle_roll, \
                                                            pid_angle_pitch,  \
                                                            pid_angle_yaw,    \
                                                            pid_palstance_roll, \
                                                            pid_palstance_pitch,\
                                                            pid_palstance_yaw);  
    void PID_struct_init(PID_Typedef * pid);
    void PID_Postion_Cal(
    PID_Typedef * PID,
    float target,
    float measure,
    float dt);
#endif